package com.sanjishu.enterlab.electricity.sale.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class SpringExceptionHandler {

    private static final Logger log = LoggerFactory.getLogger(SpringExceptionHandler.class);

    @ExceptionHandler(value = {Exception.class})
    @ResponseBody
    public Response exceptionHandler(Exception ex, Model model) {
        log.error("", ex);
        Response response = Response.getError("系统出错！");
        return response;
    }

}
